﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/MasterPage.Master" AutoEventWireup="true" CodeBehind="ListPosts.aspx.cs" Inherits="DrivingCRM.Views.Private.Forum.ListPosts" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="title" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="banniere" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="nav" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="contenu" runat="server">
    <h2>Liste des Posts</h2>
    <asp:ListView ID="ListView1" runat="server" DataKeyNames="IdPost" 
        DataSourceID="DS_Posts">
        <EmptyDataTemplate>
            Aucun post dans la base.
        </EmptyDataTemplate>
        <ItemSeparatorTemplate>
<hr />
        </ItemSeparatorTemplate>
        <ItemTemplate>
            <table style="background-color: #D5E9F0;color: #000000;">
            <tr>
                <td style='border-bottom:1px solid grey'>Titre du post:</td>
                <td style='border-bottom:1px solid grey'><asp:Label ID="IdPostLabel" runat="server" Text='<%# Eval("Title") %>' /></td>
            </tr>
            <tr>
                <td colspan="2"><asp:Label ID="ContentLabel" runat="server" Text='<%# Eval("Content") %>' /></td>
             </tr>
             <tr>
                <td style='border-top:1px solid grey'>Date de création:</td>
                <td style='border-top:1px solid grey'><asp:Label ID="CreationDateLabel" runat="server" Text='<%# Eval("CreationDate") %>' /></td>
               </tr>
               
                <tr>
                    <td>Nom de l'utilisateur:</td>
                    <td><asp:Label ID="UserLabel" runat="server" Text='<%# Eval("User.Firstname") + " " + Eval("User.Lastname") %>' /></td>
                </tr>
            </table>
        </ItemTemplate>
        <LayoutTemplate>
            <ul ID="itemPlaceholderContainer" runat="server" 
                style="font-family: Verdana, Arial, Helvetica, sans-serif;">
                <li runat="server" id="itemPlaceholder" />
            </ul>
            <div style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
            </div>
        </LayoutTemplate>
    </asp:ListView>
    <asp:EntityDataSource ID="DS_Posts" runat="server" 
        ConnectionString="name=Model_DrivingCRMContainer"
        onselecting="DS_Posts_Selecting"
        DefaultContainerName="Model_DrivingCRMContainer" EnableFlattening="False" 
        EntitySetName="PostSet" EntityTypeFilter="Post"
        Select=""
        Where="it.DiscussionIdDiscussion == @IdDiscussion" Include="User">
        
        <WhereParameters>
            <asp:Parameter Name="IdDiscussion" Type="Int32"/>
        </WhereParameters>
    </asp:EntityDataSource>
    <table>
      <tr>
            <td><asp:Label ID="Label1" runat="server" Text="Titre :"></asp:Label>
            <asp:TextBox ID="TextBox_title" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="TitleRequired" runat="server" 
                        ControlToValidate="TextBox_title" ErrorMessage="Le titre est requis." 
                        ToolTip="Le titre est requis." ValidationGroup="AddNewPost">*</asp:RequiredFieldValidator>
            </td>   
      </tr>
      <tr>
        <td>
            <asp:Label ID="L_ErrorMessage" runat="server" Text=""></asp:Label></td>
      </tr>
      <tr>
        <td><telerik:RadEditor ID="RadEditor_Post" runat="server">
        </telerik:RadEditor>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="RadEditor_Post" ErrorMessage="Le contenu est requis." 
                        ToolTip="Le contenu est requis." ValidationGroup="AddNewPost">*</asp:RequiredFieldValidator>
        </td>
      </tr>
      <tr>
        <td><asp:Button ID="InsertPost_Button" runat="server" Text="Insérer un post" OnClick="InsertPost_Clicked"/></td>
    </tr>
    </table>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="footer" runat="server">
</asp:Content>
